package com.xy.generate.cli;

import picocli.CommandLine;

import java.util.Arrays;

@CommandLine.Command(name = "demo", description = "demo", mixinStandardHelpOptions = true)
public class demoCli implements Runnable {
    @CommandLine.Option(names = {"-f", "--font-size"}, arity = "0..1", description = "Font size (default: ${DEFAULT-VALUE})", interactive = true)
    int fontSize = 19;
    @CommandLine.Parameters(paramLabel = "<word>", defaultValue = "Hello,World", description = "Words to say")
    private String[] words = {"Hello", "picocli"};
    @CommandLine.Option(names = {"-p", "--password"}, arity = "0..1", description = "Password", interactive = true)
    private String password;

    @Override
    public void run() {
        System.out.println("fontSize: " + fontSize);
        System.out.println("words: " + Arrays.toString(words));
        System.out.println("password: " + password);
    }

    public static void main(String[] args) {
        int exitCode = new CommandLine(new demoCli()).execute("-f", "20", "-p", "2003");
        //System.exit(exitCode);
    }
}
